﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using Util.Domains;
using Util.Domains.Auditing;

namespace IterationLife.Domains.Sports.Models {
    /// <summary>
    /// 体育比赛分组运动员
    /// </summary>
    [Description( "体育比赛分组运动员" )]
    public partial class SportEventGroupPerson : AggregateRoot<SportEventGroupPerson>,IDelete,IAudited {
        /// <summary>
        /// 初始化体育比赛分组运动员
        /// </summary>
        public SportEventGroupPerson() : this( Guid.Empty ) {
        }

        /// <summary>
        /// 初始化体育比赛分组运动员
        /// </summary>
        /// <param name="id">体育比赛分组运动员标识</param>
        public SportEventGroupPerson( Guid id ) : base( id ) {
        }

        /// <summary>
        /// 运动员编号
        /// </summary>
        public Guid? SportAthleteId { get; set; }
        /// <summary>
        /// 体育比赛分组Id
        /// </summary>
        public Guid? SportEventGroupId { get; set; }
        /// <summary>
        /// 个人全场数据
        /// </summary>
        public string JsonData { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreationTime { get; set; }
        /// <summary>
        /// 创建人
        /// </summary>
        public Guid? CreatorId { get; set; }
        /// <summary>
        /// 最后修改时间
        /// </summary>
        public DateTime? LastModificationTime { get; set; }
        /// <summary>
        /// 最后修改人
        /// </summary>
        public Guid? LastModifierId { get; set; }
        /// <summary>
        /// 是否删除
        /// </summary>
        [Required(ErrorMessage = "是否删除不能为空")]
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 用户
        /// </summary>
        public virtual IterationLife.Domains.Sports.Models.SportUser SportUser { get; set; }

        /// <summary>
        /// 运动员
        /// </summary>
        public virtual IterationLife.Domains.Sports.Models.SportAthlete SportAthlete { get; set; }
        
        /// <summary>
        /// 体育比赛分组
        /// </summary>
        public virtual IterationLife.Domains.Sports.Models.SportEventGroup SportEventGroup { get; set; }
        
        /// <summary>
        /// 添加描述
        /// </summary>
        protected override void AddDescriptions() {
            AddDescription( "体育比赛分组运动员编号", Id );
            AddDescription( "运动员编号", SportAthleteId );
            AddDescription( "体育比赛分组Id", SportEventGroupId );
            AddDescription( "个人全场数据", JsonData );
            AddDescription( "创建时间", CreationTime );
            AddDescription( "创建人", CreatorId );
            AddDescription( "最后修改时间", LastModificationTime );
            AddDescription( "最后修改人", LastModifierId );
        }
        
        /// <summary>
        /// 添加变更列表
        /// </summary>
        protected override void AddChanges( SportEventGroupPerson newEntity ) {
            AddChange( "Id", "体育比赛分组运动员编号", Id, newEntity.Id );            
            AddChange( "SportAthleteId", "运动员编号", SportAthleteId, newEntity.SportAthleteId );
            AddChange( "SportEventGroupId", "体育比赛分组Id", SportEventGroupId, newEntity.SportEventGroupId );
            AddChange( "JsonData", "个人全场数据", JsonData, newEntity.JsonData );
            AddChange( "CreationTime", "创建时间", CreationTime, newEntity.CreationTime );
            AddChange( "CreatorId", "创建人", CreatorId, newEntity.CreatorId );
            AddChange( "LastModificationTime", "最后修改时间", LastModificationTime, newEntity.LastModificationTime );
            AddChange( "LastModifierId", "最后修改人", LastModifierId, newEntity.LastModifierId );
        }
    }
}